<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.1/css/bootstrap.min.css" rel="stylesheet" />
  <script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>
  <style>
    /* body {
      background: url('/client_home/public/images/1.jpg') !important;
      background-repeat: no-repeat;
      background-size: 100vw 100vh;
      height: 100vh;
    } */
    .box111{
      background: url('/images/1.jpg');
      background-repeat: no-repeat;
      background-size: 100% ;
      height: 100vh;
      /* background-color:red; */
    }
    .wrap {
      margin-top: 100px;
      background-color: rgba(255, 255, 255, 0.147);
      width: 300px;
      padding-top: 30px;
      text-align: center;
    }

    #saveBtn {
      width: 270px;
    }

    a {
      text-decoration: none;
    }

    .padding-top-bottom {
      padding-top: 10px;
      padding-bottom: 10px;
    }
  </style>
</head>

<body>
  <div class="box111">
    <nav class="navbar navbar-expand-lg navbar-light">
      <div class="container">
        <h1 class="text-info fs-1">啊giao仓库管理系统</h1>
      </div>
    </nav>
    <div class="container wrap rounded-4">
      <h2 class="text-info">用户登录</h2>
      <div class="input-group mb-3">
        <input type="text" class="form-control" placeholder="请输入用户名" aria-label="Username"
          aria-describedby="basic-addon1" id="realname">
      </div>
      <div class="input-group mb-3">
        <input type="password" class="form-control" placeholder="请输入密码" aria-label="Username"
          aria-describedby="basic-addon1" id="pwd">
      </div>
      <button type="submit" class="btn btn-primary" id="saveBtn">登录</button>
      <div class="form-check padding-top-bottom">
        <div>
          <input class="form-check-input" type="checkbox" value="" id="invalidCheck" required>
          <label class="form-check-label" for="invalidCheck">
            同意条款和条件
          </label>
          <div class="invalid-feedback">
            您必须同意才能提交。
          </div>
        </div>
      </div>
    </div>
  </div>
  <script>
    $('#saveBtn').click(function () {
      $.ajax({
        method: 'get',
        url: 'http://localhost:3000/login/login',
        data: {
          'username': realname.value,
          'password': pwd.value,
        },
        success: function (data) {
          console.log(data)
          if(data){
            location.href='/index/index.html';
          }
        },
        error: function (e) {
          console.log(JSON.stringify(e));
        }
      })
    })
  </script>
</body>

</html>